#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
#include <string>

/*
  (1.5*) Create a vector<string> and read a list of names of fruits
  from cin into it. Sort the list and print it.
 */

typedef std::istream_iterator<std::string> istream_iterator_string;

int main()
{
  std::vector<std::string> fruits;

  std::istream_iterator<std::string> begin_of_cin(std::cin);
  std::istream_iterator<std::string> end_of_cin;
  std::back_insert_iterator<std::vector<std::string> > dest(fruits);

  std::copy(begin_of_cin, end_of_cin, dest);

  std::cout << "Input:" << std::endl;
  std::copy(fruits.begin(), fruits.end(), std::ostream_iterator<std::string>(std::cout, " "));
  std::cout << std::endl;

  std::sort(fruits.begin(), fruits.end());

  std::cout << "Output:" << std::endl;
  std::copy(fruits.begin(), fruits.end(), std::ostream_iterator<std::string>(std::cout, " "));
  std::cout << std::endl;
}
